import fetch from '@/common/utils/http'

export interface QueryParams {
  limit: number
  name?: string
  page: number
  status: '' | 0 | 1
}

export interface StatusParams {
  status: 0 | 1
  id: string
}
// 查询语音导航列表
export const getQuery = (data: any) =>
  fetch({
    url: '/call/web/call/action/config/ivr/query',
    method: 'GET',
    data
  })
// 导入语音导航
export const ivrImport = (data: any) =>
  fetch({
    url: '/call/web/call/action/config/ivr',
    method: 'POST',
    data
  })
// 删除语音导航
export const ivrDelete = (data: { id: string }) =>
  fetch({
    url: `/call/web/call/action/config/ivr/${data.id}`,
    method: 'DELETE',
    data: {
      id: data.id
    }
  })
// 新建语音导航
export const ivrAdd = (data: any) =>
  fetch({
    url: '/call/web/call/action/config/ivr',
    method: 'POST',
    data
  })
// 修改ivr的状态（停用或者启用）
export const changeStatus = (data: StatusParams) =>
  fetch({
    url: '/call/web/call/action/config/ivr/status',
    method: 'PUT',
    data
  })
// 播放语音节点合成预览
export const generateVoice = (data: StatusParams) =>
  fetch({
    url: '/call/web/call/action/config/ivr/generate',
    method: 'POST',
    data
  })
